package main.Q2401_2500;

public class Q2421_2430 {
    public static void main(String[] args) {
        System.out.println("Question2421：");
        System.out.println("Question2422：");
        System.out.println("Question2423：");
        System.out.println("Question2424：");
        System.out.println("Question2425：");
        System.out.println("Question2426：");
        System.out.println("Question2427：");
        System.out.println("Question2428：沙漏的最大总和");
        System.out.println("Question2429：");
        System.out.println("Question2430：");
    }
}

class Question2428 {
    public int process(int row, int col, int[][] grid) {
        int result = Integer.MIN_VALUE;
        int row1 = row + 1, row2 = row + 2, col1 = col + 1, col2 = col + 2;
        if (row2 < grid.length && col2 < grid[0].length) {//满足要求
            result = 0;
            result += grid[row][col];
            result += grid[row][col1];
            result += grid[row][col2];
            result += grid[row1][col1];
            result += grid[row2][col];
            result += grid[row2][col1];
            result += grid[row2][col2];
        }
        return result;
    }

    public int maxSum(int[][] grid) {
        int result = Integer.MIN_VALUE;
        for (int i = 0; i < grid.length; i++) {
            for (int j = 0; j < grid[0].length; j++) {
                result = Math.max(result, process(i, j, grid));
            }
        }
        return result;
    }
}